package com.xhui.vimarket.zkplus.utils;

public class NumUtils {
    
    public static long toLong(String str) {
        long lpResult = 0;
        if (str == null) {
            str = "";
        } else {
            str = str.trim();
        }
        try {
            lpResult = Long.parseLong(str);
        } catch (final NumberFormatException nfe) {
        }
        return lpResult;
    }
    
    /**
     * 将字符串转化为int类型 Converts a string to integer. If fails is not throwing a
     * NumberFormatException, instead return 0.
     * 
     * @param str
     *            待转换的字符串
     * @return int 数据
     * @author: chenjun
     * @修改记录： ==============================================================<br>
     *        日期:2007-9-21 chenjun 创建方法，并实现其功能
     *        ==============================================================<br>
     */
    public static int toInt(String str) {
        int lpResult = 0;
        if (str == null) {
            str = "";
        } else {
            str = str.trim();
        }
        try {
            lpResult = Integer.parseInt(str);
        } catch (final NumberFormatException nfe) {
        }
        return lpResult;
    }
    
}
